<div class="navbar navbar-inverse navbar-fixed-top" role="navigation">
       <div class="container">
              <nav class="navbar-header">
                     @foreach ($nav as $key => $value)
                            <a class="navbar-brand"  href="{{ $value->href }}">{{ $value->name }}</a>
                     @endforeach
              </nav>
              <div class="navbar-nav navbar-right">
                     <a href="#" class="navbar-brand"></a>
                     @if (empty($username))
                            <a href="{{ url('Login') }}" class="navbar-brand">登陆</a>
                     @else
                            <a href="#" class="navbar-brand dropdown-toggle" data-toggle="dropdown">{{ $username }} <span class="caret"></span></a>
                                   <ul class="dropdown-menu" role="menu" style="right: auto;">
                                          @if (config('setcheck.check') != Session::get('id' ,'0'))
                                          <li><a data-toggle="modal" data-target="#Interlocution">对话
                                                 <span id="badge" class="badge"></span>      
                                          </a></li>
                                          @else
                                          <li><a href="{{ url('Edit') }}">Admin
                                                 <span id="badge" class="badge"></span>      
                                          </a></li>
                                          @endif
                                          <li class="divider"></li>
                                          <li><a href="{{ url('Loginout') }}">退出</a></li>
                                   </ul>
                     @endif
              </div>
       </div>
</div>
@if (!empty($username) && config('setcheck.check') != Session::get('id' ,'0'))
<div class="modal fade" id="Interlocution" tabindex="-1" role="dialog" aria-labelledby="myModalLabel">
  <div class="modal-dialog" role="document">
    <div class="modal-content">
      <div class="modal-header">
        <button type="button" class="close" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">&times;</span></button>
        <h4 class="modal-title" id="myModalLabel">对话框</h4>
      </div>
      <div id="Interlocution-body" class="modal-body">
       
      </div>
      <hr>
       <input type="text" class="form-control" placeholder="可能你并没有什么想跟我说的?" id="str">
      <div class="modal-footer">
        <button type="button" class="btn btn-default" data-dismiss="modal">Close</button>
        <button type="button" class="btn btn-primary" id="subtxt">Save</button>
      </div>
    </div>
  </div>
</div>
<script type="text/javascript">
  var load= false;
  var html = '<iframe src="{{ url('Interlocution') }}?for={{ config('setcheck.check') }}" frameborder="0" scroling="yes" width="100%" id="iframe" ></iframe>';
  $('#Interlocution').on('show.bs.modal', function (e) {
    if(load != true){
      $('#Interlocution-body').append(html);
      $('#badge').text('');
      load = true;
    }
  });

  var body;
  $("#subtxt").click(function(){
    body = $('#str').val();
    $.post('{{ url('Interlocution') }}?for='+{{ config('setcheck.check') }}, {body : body , _token : '{{ csrf_token() }}'}, function (data){
      if(data.status == 1){
        $('#str').val('');
        $('#iframe').attr('src', $('#iframe').attr('src'));
      }
    }, 'json');
  });

  function MsgCallback(){
    $.get('{{ url('MsgCallback') }}', {}, function (data){
      if(data.status == 1){
        $('#badge').text(data.info);
        $('#Interlocution-body > iframe').remove();
        load= false;
      }
    }, 'json');
  }
  MsgCallback();
  setInterval('MsgCallback()', 10000);
</script>
@endif